import moment from 'moment';
import { connect } from 'umi';
import { useEffect } from 'react';
import { useTRState } from '#/utils/trHooks.jsx';
import styles from './index.less';
import OperateLogModal from '../OperateLogModal';
import PlanReportPreview from '../PlanReportPreview';

const HeadRight = ({ powerLimitInfo, selectedPlan, dispatch }) => {
  useEffect(() => {}, []);
  return (
    <div className={styles.right}>
      {!!selectedPlan?.name && (
        <div className={styles.right__save_info}>
          {selectedPlan.plan}
          <span>最近保存时间：</span>
          {moment(selectedPlan.saveDate).format('YYYY.MM.DD HH:SS')}
          <br />
          <span style={{ padding: '0 10px 0 76px' }}>操作人：</span>
          {selectedPlan.name}
        </div>
      )}
      <PlanReportPreview />
      <OperateLogModal />
    </div>
  );
};

export default connect(({ interprovincialSpotDeclaration }) => ({
  powerLimitInfo: interprovincialSpotDeclaration.powerLimitInfo,
  selectedPlan: interprovincialSpotDeclaration.selectedPlan,
}))(HeadRight);
